<?php
class Claycode_uri
{
	private $arr_requestUri;
	private $arr_appRequest;
	private $arr_appParameters;
	
	public function __construct()
	{
		$this->arr_requestUri = explode('/', $_SERVER['REQUEST_URI']);
		$this->arr_scriptName = explode('/', $_SERVER['SCRIPT_NAME']);
		$this->mapUriParts();
	}
	
	private function mapUriParts()
	{
		for($i= 0;$i < sizeof($this->arr_scriptName);$i++){
			if ($this->arr_requestUri[$i] == $this->arr_scriptName[$i]){
				unset($this->arr_requestUri[$i]);
			}
		}
		$this->arr_appRequest = array_values($this->arr_requestUri);
		$this->arr_appParameters = array_slice($this->arr_appRequest, 1);
	}
	
	public function getAppRequest()
	{
		return $this->arr_appRequest;
	}
	
	public function getAppParameters()
	{
		return $this->arr_appParameters;
	}
	
}